package homework.day01;

import javax.swing.*;
import java.io.File;
import java.io.IOException;
import java.util.Scanner;

public class Text05 {
    public static void main(String[] args) throws IOException {
        Scanner in = new Scanner(System.in);
        while(true){
            System.out.println("请输入文件名");
            String name = in.next();
            File file = new File(name + ".txt");
            if (file.exists()){
                System.out.println("文件名重复，请重新输入！");
            }else{
                file.createNewFile();
                System.out.println("文件创建完毕！");
                break;
            }
        }
    }
}
